package thread_01;

public class Demo05 {
    public static void main(String[] args) {
//                            (形参）
        Thread t = new Thread(() -> {
//            函数体
            while(true){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
//                    继续抛出新的异常（新版idea)
                    throw new RuntimeException(e);
//                    答应异常调用栈（老版idea）
//                    e.printStackTrace();
                }
            }
        });

        t.start();
        while(true){
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
